package com.his.dao.jpa;

import java.util.List;

import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import org.springframework.data.repository.query.Param;

import com.his.pojos.jpa.HisOperation;
import com.his.vo.OperationDrugVO;

public interface MxjOperationDAO extends CrudRepository<HisOperation,Long> {
	@Query("select max(ssNo) from HisOperation")
	public String findmaxId();
	
	@Query("select ssNo from HisOperation where ssNo=:ssNo")
	public String ynssNo(@Param("ssNo")long ssNo);
	
	@Query("select "
			+ "new com.his.vo.OperationDrugVO( o.ssNo,c.ylkNo, c.brName, o.ssName,c.brSex, c.brAge, d.ksName) "
			+ "from HisOperation o,HisOperationdetail d,HisMedicalCard c "
			+ "where o.ssNo=d.ssNo and d.ylkNo=c.ylkNo")
	public List<OperationDrugVO> findopdrug();
	
	@Query("from HisOperation where ssNo=:ssNo")
	public HisOperation findByssNo(@Param("ssNo")long ssNo);
	
}
